/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pm.devices.drives;

import pm.devices.drives.DriveType;

import javax.swing.*;
import java.util.ResourceBundle;

/**
 * @author Anton Bernatski
 */
public class Drive {

	private static ResourceBundle bundle = java.util.ResourceBundle.getBundle("pm/devices/Bundle"); // NOI18N

	private String id;
	private DriveType type;

	public Drive(String id, DriveType type) {
		this.id = id;
		this.type = type;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public DriveType getType() {
		return type;
	}

	public void setType(DriveType type) {
		this.type = type;
	}

	public String getDisplayableText() {
		if (type == null) return bundle.getString("Devices.unknown.caption") + " (" + getId() + ")";
		switch (type) {
			case CD_DVD:
				return bundle.getString("Devices.cd.caption") + " (" + getId() + ")";
			case REMOVABLE:
				return bundle.getString("Devices.removable.caption") + " (" + getId() + ")";
			default:
				return bundle.getString("Devices.unknown.caption") + " (" + getId() + ")";
		}
	}

	public ImageIcon getIcon(){
		if (type == null) return new ImageIcon("images/unknown.jpg");
		switch (type) {
			case CD_DVD:
				return new ImageIcon("images/cd.jpg");
			case REMOVABLE:
				return new ImageIcon("images/removable.jpg");
			default:
				return new ImageIcon("images/unknown.jpg");
		}
	}
}
